#include<iostream>
#include<cstdio>
using namespace std; 
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	int n,m;
	cin>>n>>m;
	int a[8005];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=m;i++){
		int b;
		cin>>b;
		if(b==1)
		{
			int x,y;
			cin>>x>>y;
			a[x]=y;
		}
		else
		{
			int x;
			cin>>x;
			int k=a[x];
			int count1=0,count2=0;
			for(int i=1;i<=x;i++){
				if(a[i]==k)
				{
					count1++;
				}
			}
			for(int i=1;i<=n;i++){
				if(a[i]<k)
				{
					count2++;
				}
			}
			cout<<count1+count2<<endl;
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
